package com.gexada.simplechat.util;

import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;

public class UserRoleHelper {
	
	public static final String SERVICE_ROLE = "SERVICE_ROLE";

	public static final String CUSTOMER_ROLE = "CUSTOMER_ROLE";

	public static boolean isService(Collection<? extends GrantedAuthority> roles) {
		if(roles == null) {
			return false;
		}
		for(GrantedAuthority role : roles) {
			return SERVICE_ROLE.equals(role.getAuthority());
		}
		return false;
	}
}
